<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
    String queryString = request.getQueryString() == null ? "" : request.getQueryString().replaceAll("(\\&?lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2})|(lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2}\\&?)", "");
    String lang = request.getParameter("lang");
    if (lang != null) {
        session.setAttribute("locale", lang);
    } else if (session.getAttribute("locale") == null){
        session.setAttribute("locale", request.getLocale().toString());
    }
%>
<!DOCTYPE html>
<html lang="zh">
<c:if test="${'zh_CN'.equals(sessionScope.locale)}">
    <fmt:setLocale value="zh_CN"/>
</c:if>
<c:if test="${sessionScope.locale.indexOf('en') != -1}">
    <fmt:setLocale value="en_US"/>
</c:if>
<fmt:setBundle basename="charts" var="charts" />
<fmt:bundle basename="charts">
<head>
    <title>Title</title>
    <link rel="stylesheet" href="<%=basePath%>/plugins/select2/select2.min.css">
    <link href="<%=basePath%>/plugins/charts/css/select2-my.css" rel="stylesheet"/>
    <link href="<%=basePath%>/plugins/charts/css/style.css" rel="stylesheet"/>
</head>
<body>
    <div class="choose">
        <div class="choose_margin">
            <table>
                <thead>
                <tr>
                    <th colspan="2" style="color:#fff;font-size:1.2em;background:none;padding-bottom:20px;letter-spacing:4px;"><fmt:message key="share.sift.sxtj"/></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.department"/>"><fmt:message key="share.sift.yyks"/></td>
                    <td class="tl">
                        <select class="select select_hospital" multiple="multiple"></select>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.risk"/>"><fmt:message key="share.sift.sbfxdj"/></td>
                    <td class="tl">
                        <select class="select select_risk" multiple="multiple"></select>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.type"/>"><fmt:message key="share.sift.sb68fl"/></td>
                    <td class="tl">
                        <select class="select select_type" multiple="multiple"></select>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.brand"/>"><fmt:message key="share.sift.sbcj"/></td>
                    <td class="tl">
                        <select class="select select_brand" multiple="multiple"></select>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.year"/>"><fmt:message key="share.sift.dqnf"/></td>
                    <td class="tl">
                        <select class="select select_year"></select>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.yf"/>"><fmt:message key="share.sift.yf"/></td>
                    <td class="tl">
                        <select class="select select_month">
                            <option value=""></option>
                            <option value="1"><fmt:message key="month.yi"/></option>
                            <option value="2"><fmt:message key="month.er"/></option>
                            <option value="3"><fmt:message key="month.san"/></option>
                            <option value="4"><fmt:message key="month.si"/></option>
                            <option value="5"><fmt:message key="month.wu"/></option>
                            <option value="6"><fmt:message key="month.liu"/></option>
                            <option value="7"><fmt:message key="month.qi"/></option>
                            <option value="8"><fmt:message key="month.ba"/></option>
                            <option value="9"><fmt:message key="month.jiu"/></option>
                            <option value="10"><fmt:message key="month.shi"/></option>
                            <option value="11"><fmt:message key="month.shiyi"/></option>
                            <option value="12"><fmt:message key="month.shier"/></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.enable_year"/>"><fmt:message key="share.sift.sbqynf"/></td>
                    <td class="tl">
                        <input type="text" class="input" id="enableYearStart"/>
                        <span class="to"> <fmt:message key="share.sift.z"/></span>
                        <input type="text" class="input" id="enableYearEnd"/>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.price"/>"><fmt:message key="share.sift.sbje(wy)"/></td>
                    <td class="tl">
                        <input type="text" class="input" id="priceStart"/>
                        <span class="to"> <fmt:message key="share.sift.z"/></span>
                        <input type="text" class="input" id="priceEnd"/>
                    </td>
                </tr>
                <tr>
                    <td class="tr" title="<fmt:message key="tips.age_limit"/>"><fmt:message key="share.sift.nxzs"/></td>
                    <td class="tl">
                        <input type="text" class="input" id="ageLimitStart"/>
                        <span class="to"> <fmt:message key="share.sift.z"/></span>
                        <input type="text" class="input" id="ageLimitEnd"/>
                    </td>
                </tr>
                <tr>
                    <td class="tr"></td>
                    <td class="tl">
                        <label style="margin-right: 10px">
                            <input type="radio" class="flat-green" value="1" name="limit-range">
                            <span>0.0-0.5</span>
                        </label>
                        <label style="margin-right: 10px">
                            <input type="radio" class="flat-green"  value="2" name="limit-range">
                            <span>0.5-1.0</span>
                        </label>
                        <label>
                            <input type="radio" class="flat-green" value="3" name="limit-range">
                            <span>1.0-1.5</span>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td class="tc" colspan="2">
                        <input type="button" value="<fmt:message key="share.sift.qr"/>"
                               class="button block" onclick="checkParams()">
                        <input type="button" value="<fmt:message key="share.sift.qx"/>"
                               class="button block" onclick="(function(){ChooseBox.close()})()">
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <script src="<%=basePath%>/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="<%=basePath%>/plugins/jQuery/jquery.cookie.js"></script>
    <script src="<%=basePath%>/plugins/select2/select2.full.min.js"></script>
    <script>
        if (localStorage.getItem('auth') == 1) {
            $('#btn1').show();
        } else {
            $('#btn1').hide();
        }
        $('.select_month').select2({
            placeholder: '<fmt:message key="share.sift.qxz"/>',
            allowClear: true
        });

        function checkParams () {
            /* 启用年份验证 1990-2099正整数 */
            var enYs = $('#enableYearStart');
            var enYe = $('#enableYearEnd');
            if (/^((199\d{1})|(20\d{2})){0,1}$/.test(enYs.val()) && /^((199\d{1})|(20\d{2})){0,1}$/.test(enYe.val())) {
                if (enYs.val() && enYe.val() && (enYs.val() >= enYe.val())) {
                    enYs.addClass('error');
                    enYe.addClass('error');
                    flavrShowByTime('<fmt:message key="share.sift.qsrzqdqynxqj"/>', null, "danger", false);
                    return;
                } else {
                    enYs.removeClass('error');
                    enYe.removeClass('error');
                }
            } else {
                enYs.addClass('error');
                enYe.addClass('error');
                flavrShowByTime('<fmt:message key="share.sift.qsrzjdnf"/>', null, "danger", false);
                return;
            }
            /* 设备金额验证 正整数 */
            var ps = $('#priceStart');
            var pe = $('#priceEnd');
            if (/^\d*$/.test(ps.val()) && /^\d*$/.test(pe.val())) {
                if (ps.val() && pe.val() && (ps.val() >= pe.val())) {
                    ps.addClass('error');
                    pe.addClass('error');
                    flavrShowByTime('<fmt:message key="share.sift.qsrzjdsbjeqj"/>', null, "danger", false);
                    return;
                } else {
                    ps.removeClass('error');
                    enYe.removeClass('error');
                }
            } else {
                ps.addClass('error');
                pe.addClass('error');
                flavrShowByTime('<fmt:message key="share.sift.qsrzzs"/>', null, "danger", false);
                return;
            }
            /* 年限指数验证 大于0的小数 */
            var as = $('#ageLimitStart');
            var ae = $('#ageLimitEnd');
            if (/^\d*(\.\d*)?$/.test(as.val()) && /^\d*(\.\d*)?$/.test(ae.val())) {
                if (as.val() && ae.val() && (as.val() >= ae.val())) {
                    as.addClass('error');
                    ae.addClass('error');
                    flavrShowByTime('<fmt:message key="share.sift.qsrzqdnxzsqj"/>', null, "danger", false);
                    return;
                } else {
                    as.removeClass('error');
                    ae.removeClass('error');
                }
            } else {
                as.addClass('error');
                ae.addClass('error');
                flavrShowByTime('<fmt:message key="share.sift.qsrdylds"/>', null, "danger", false);
                return;
            }
            ChooseBox.close();

            getParams();
        }
    </script>
</body>
</fmt:bundle>
</html>
